package TUILayer;
import java.util.Scanner;

public class MainUI
{
    private String idAssistant;
    
    
    public MainUI(String idAssistant){
        this.idAssistant = idAssistant;
        selectMenu();
    }
    
    public String getIDAssistant()
    {
        return idAssistant;
    }
    
    private int MainMenu()
    {      
            Scanner keyboard = new Scanner(System.in);
            System.out.println("\f *** Main Menu ***");
            System.out.println(" Logged as: " +getIDAssistant());
            System.out.println(" (1) Customer menu");
            System.out.println(" (2) Order menu");
            System.out.println(" (3) Loan menu");
            System.out.println(" (4) Exit");
            System.out.print("\n Make your choice: ");
            
            int choise = keyboard.nextInt();
            
            return choise;
    }
    private void selectMenu(){
        boolean exit = false;
       while(!exit)
       {
          int choise = MainMenu(); 
          if(choise == 1)
          {   
              new CustomerUI(getIDAssistant()).start();
          }
          else{
              if(choise == 2){
                   new OrderUI(getIDAssistant()).start();
              }  
              else{
                  if(choise == 3){
                     new LoanUI(getIDAssistant()).start();
                  }  
                    
                        else{
                             exit = true;
                        }
                        }
                    }
       }
    }
}